<?php
class MVC_View_Container implements MVC_View_Container_Interface {

    private $_arViews = array();


    private $_objConfig = null;


    public function __construct (Config_Interface $objConfig) {
        $this->_objConfig = $objConfig;
    }


    public function addView ($strViewName) {
         $objMvcViewElement = new MVC_View_Element($strViewName, $this->_objConfig);
         $this->_arViews[] = $objMvcViewElement;
        return $objMvcViewElement;
    }


    public function render () {
        $strBuffer = '';
        ob_start();

        foreach ($this->_arViews as $item) {
            /* @var $item MVC_View_Element_Interface */
            $item->render();
        }

        $strBuffer = ob_get_contents();
        ob_end_clean();

        return $strBuffer;
    }

}